#include<iostream>
using namespace std;
#include<vector>
int is_post(vector<int> a, int end)
{
	vector<int> v1, v2;
	int i=0;
	for (i; i < end; i++)
	{
		if (a[i] < a[end])
			v1.push_back(a[i]);
		else
			break;
	}
	for (i; i < end; i++)
	{
		if (a[i] > a[end])
			v2.push_back(a[i]);
		else
			return 0;
	}
	int m = 1;
	int n = 1;
	if (!v1.empty())
		m = is_post(v1, v1.size()-1);
	if (!v2.empty())
		n = is_post(v2, v2.size()-1);
	return m && n;
}
int main()
{
	vector<int> a;
	int n=0;
	int m;
	cin >> m;
	a.push_back(m);
	//cout << m << ' ';
	n++;
	while (getchar()!='\n')
	{
		cin >> m;
			a.push_back( m);
		//cout << m << ' ';
			n++;
	}
	if (is_post(a, n-1))
		cout << "true" << endl;
	else
		cout << "false" << endl;

}